<template>
  <div>
    <s-table
      ref="table"
      rowKey="key"
      :columns="columns"
      :data="loadData"
      :scroll="{ x: 2000 }"
      class="user_management_table"
    >
      <span slot="order_no" slot-scope="text, record">
        <a @click="godetailes(record.id)">{{ text }}</a>
      </span>
      <span slot="student" slot-scope="text, record">
        <div>{{ record.student.name }}</div>
        <div>{{ record.student.main_phone }}</div>
      </span>
      <div slot="order_type" slot-scope="text, record">
        <span v-if="record.order_type==1">报名</span>
        <span v-if="record.order_type==2">退费用</span>
        <span v-if="record.order_type==3">退物品</span>
        <span v-if="record.order_type==4">退课</span>
        <span v-if="record.order_type==5">转课</span>
      </div>
      <span slot="buy_project" slot-scope="text, record">
        <span v-if="record.order_type==5">
          <span>
            <a-tooltip placement="topLeft" v-if="record.refunds!=''">
              <template slot="title">
                <div>
                  转出：
                  <span v-for="(item,index) in record.refunds" :key="index">
                    <span v-if="item.project" style="margin:5px;">{{ item.project.name }}</span>
                    <span v-if="item.total_amount">{{ item.total_amount }} 元</span>
                  </span>
                </div>
                <div>
                  转入：
                  <span v-for="(item,index) in record.orderContent" :key="index">
                    <span v-if="item.project" style="margin:5px;">{{ item.project.name }}</span>
                    <span v-if="item.signing_price">{{ item.signing_price }} 元</span>
                  </span>
                </div>
              </template>
              <span>
                转出：
                <span v-for="(item,index) in record.refunds" :key="index">
                  <span v-if="item.project" style="margin:5px;">{{ item.project.name }}</span>
                  <span v-if="item.total_amount">{{ item.total_amount }} 元</span>
                </span>
              </span>
              <br />
              <span>
                转入：
                <span v-for="(item,index) in record.orderContent" :key="index">
                  <span v-if="item.project" style="margin:5px;">{{ item.project.name }}</span>
                  <span v-if="item.signing_price">{{ item.signing_price }} 元</span>
                </span>
              </span>
            </a-tooltip>
          </span>
        </span>
        <div v-else class="onehidden">
          <a-tooltip placement="topLeft" v-if="record.orderContent!=''">
            <template slot="title">
              <span v-for="(item,index) in record.orderContent" :key="index">
                <p>
                  <span v-if="item.project" style="margin:5px;">{{ item.project.name }}</span>
                  <span v-if="item.signing_price">{{ item.signing_price }} 元</span>
                </p>
              </span>
            </template>
            <span v-for="(item,index) in record.orderContent" :key="index">
              <span v-if="item.project" style="margin:5px;">{{ item.project.name }}</span>
              <span v-if="item.signing_price">{{ item.signing_price }} 元</span>
            </span>
          </a-tooltip>
          <a-tooltip placement="topLeft" v-if="record.refunds!=''">
            <template slot="title">
              <span v-for="(item,index) in record.refunds" :key="index">
                <p>
                  <span v-if="item.project" style="margin:5px;">{{ item.project.name }}</span>
                  <span v-if="item.total_amount">{{ item.total_amount }} 元</span>
                </p>
              </span>
            </template>
            <span v-for="(item,index) in record.refunds" :key="index">
              <span v-if="item.project" style="margin:5px;">{{ item.project.name }}</span>
              <span v-if="item.total_amount">{{ item.total_amount }} 元</span>
            </span>
          </a-tooltip>
        </div>
      </span>
      <div slot="receivable" slot-scope="text, record">
        <span class="shoutag" v-if="record.bill_type==1">收</span>
        <span class="shoutag1" v-else>退</span>
        <span>￥{{ record.receivable }}</span>
      </div>
      <div slot="real_price" slot-scope="text, record">
        <span class="shoutag" v-if="record.bill_type==1">收</span>
        <span class="shoutag1" v-else>退</span>
        <span>￥{{ Number(record.real_price)-Number(record.bad_debt) }}</span>
      </div>
      <div slot="achievement" slot-scope="text, record">
        <span>{{ record.user_name||'-' }}</span>
      </div>
      <span slot="achievement" slot-scope="text, record">
        <a-tooltip placement="topLeft">
          <template slot="title">{{ record.user_name }}</template>
          {{ record.user_name||'-' }}
        </a-tooltip>
      </span>
      <div slot="order_source">机构创建</div>
      <!-- 支付时间 -->
      <span slot="purchase_at" slot-scope="text,record">
        <span>{{ record.purchase_at|dayjs }}</span>
      </span>
      <div slot="order_status" slot-scope="text,record">
        <span v-if="record.payment_type==1">待支付</span>
        <span v-else-if="record.payment_type==2">已支付</span>
        <span v-else-if="record.payment_type==4">已废除</span>
        <span v-else>-</span>
      </div>
      <span slot="action" slot-scope="text,record">
        <span v-if="record.payment_type!==4">
          <span v-if="Number(record.real_price)<Number(record.receivable)">
            <a @click="goprint(record.id)">打印收据</a>
            <p style="margin-top:10px;">
              <a @click="gomoney(record)">继续收款</a>
            </p>
          </span>
          <a v-else @click="goprint(record.id)">打印收据</a>
        </span>
        <span v-else>-</span>
      </span>
    </s-table>
  </div>
</template>

<script>
export default {}
</script>

<style>
</style>
